#pragma strict
class Enemy extends Character{
	var Difficulty = "Default";
	var target : Transform; //the enemy's target
	var moveSpeed = 3; //move speed
	var rotationSpeed = 3; //speed of turning
	var xcords= new Array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
	var ycords= new Array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
	var centerX=0.0;
	var centerY=0.0;
	var steps=8;
	var radius= 1;
	var every100=0;
	//var motor : CharacterMotor;
	public static var stamina: double = 100.0;
	var count = 0;
	var posX = 0;
	var posZ = 0;
	function markTarget() {
	target = GameObject.FindWithTag("Player").transform;
}
	function Start () {

	}
	

	function iMove ():boolean {
		return true;
	}
	function moveTo () {
		
	}
    var speed : float = 5.0;
    var jumpSpeed : float = 8.0;
    var gravity : float = 20.0;
    private var moveDirection : Vector3 = Vector3.zero;
function Update () {
	markTarget();
	if(every100==1000){
	for (var i = 0; i < steps; i++) {
   		xcords[i] = (centerX + radius * Mathf.Cos(2 * Mathf.PI * i / steps));
   	 	print(xcords[i]);//prints xcord
    	ycords[i] = (centerY + radius * Mathf.Sin(2 * Mathf.PI * i / steps));
    	print(ycords[i]);//prints ycord
    	every100=0;
	}}
	every100+=1;
        var controller : CharacterController = GetComponent(CharacterController);
        if (controller.isGrounded) {
            // We are grounded, so recalculate
            // move direction directly from axes
            transform.LookAt(target);
            moveDirection = Vector3(0,0,1);

            moveDirection = transform.TransformDirection(moveDirection);
            moveDirection *= speed;
        }
        // Apply gravity
        moveDirection.y -= gravity * Time.deltaTime;
        
        // Move the controller
        controller.Move(moveDirection * Time.deltaTime);
    }
	
}